<html>

<head>
    <style type="text/css">
        table.gradienttable {
            font-family: verdana, arial, sans-serif;
            border-width: 3px;
            border-collapse: collapse;
            width: 100%;
        }
        
        table.gradienttable th {
            padding: 3px;
            color: #FFFFFF;
            background: #000066;
            font-size: 12px;
        }
        
        table.gradienttable td {
            padding: 3px;
            color: #000000;
            font-size: 11px;
            background: #ebecda;
            text-align: center;
        }
        
        table.gradienttable th p {
            margin: 3px;
            padding: 9px;
        }
        
        table.gradienttable td p {
            padding: 9px;
        }
    </style>
    <style>

    </style>

    <script>
        function openWeekSummary() {
            // 获取日期选择控件的值
            var date = document.getElementById('mydate').value;

            // 构建目标URL
            var url = '/task/weeksummary?date=' + encodeURIComponent(date);

            // 打开新窗口
            window.open(url, '_blank');
        }

        function refreshFeishu() {
            var selectedMan = document.querySelector('input[name="man"]:checked').value;
            var url = '/task/feishu?man=' + encodeURIComponent(selectedMan);
            window.location.href = url;
        }

        function refreshTapd() {
            var selectedMan = document.querySelector('input[name="man"]:checked').value;
            var url = '/task/tapdtask?man=' + encodeURIComponent(selectedMan);
            window.location.href = url;
        }


        
        function check() {
            // 获取日期选择控件的值
            var date = document.getElementById('mydate').value;

            // 构建目标URL
            var url = '/task/check?date=' + encodeURIComponent(date) + '&force=true';
            window.location.href = url;
        }
    </script>
    <style>
        leftalign {
            text-align: left;
        }
        rightalign {
            width:5em;
            text-align: right;
        }
        td input {
            width: 100%;
        }
    </style>
</head>

<body>
    <div style="width:30em;margin-left:auto;margin-right:auto;">
        <table class="gradienttable" border="1" style="width:100%;line-height:2em;">
            <form action="/empl/save" method="post" id="myForm">
                <tr>
                    <td class="rightalign"><label for="sID">sID(不可修改)</label></td>
                    <td class="leftalign"><input type="number" id="sID" name="sID" required readonly value="#(empl.sID)"></td>
                </tr>
                <tr>
                    <td class="rightalign"><label for="xCode">飞书ID(不要修改)</label></td>
                    <td class="leftalign"><input type="text" id="xCode" name="xCode" required value="#(empl.xCode)"></td>
                </tr>
                <tr>
                    <td class="rightalign"><label for="xName">姓名</label></td>
                    <td class="leftalign"><input type="text" id="xName" name="xName" required value="#(empl.xName)"></td>
                </tr>
                <tr>
                    <td class="rightalign"><label for="xIsCount">[飞书]统计效率</label></td>
                    <td class="leftalign"><input type="checkbox" id="xIsCount" name="xIsCount" #if(empl.xIsCount) checked #end></td>
                </tr>
                <tr>
                    <td class="rightalign"><label for="xIsCount">[TAPD]统计效率</label></td>
                    <td class="leftalign"><input type="checkbox" id="xIsCountTapd" name="xIsCountTapd" #if(empl.xIsCountTapd) checked #end></td>
                </tr>
                <tr>
                    <td class="rightalign"><label for="xCountRate">应产出工时倍率</label></td>
                    <td class="leftalign"><input type="number" id="xCountRate" name="xCountRate" step="0.1" required value="#(empl.xCountRate)"></td>
                </tr>
                <tr>
                    <td class="rightalign"><label for="xGroup">组别</label></td>
                    <td class="leftalign"><input type="text" id="xGroup" name="xGroup" value="#(empl.xGroup)"></td>
                </tr>
                <tr>
                    <td class="rightalign"><label for="xGroupIndex">组别序号</label></td>
                    <td class="leftalign"><input type="number" id="xGroupIndex" name="xGroupIndex" value="#(empl.xGroupIndex)"></td>
                </tr>
                <tr>
                    <td class="rightalign"><label for="xIsNotice">未填报工时提醒</label></td>
                    <td class="leftalign"><input type="checkbox" id="xIsNotice" name="xIsNotice"  #if(empl.xIsNotice) checked #end></td>
                </tr>
                <tr>
                    <td class="rightalign">&nbsp;</td>
                    <td class="leftalign" style="text-align:right;"><input type="submit" value="保存"></td>
                </tr>
            </form>
        </table>
</div>
<script>
    document.getElementById('myForm').addEventListener('submit', function(event) {
        var xIsCountCheckbox = document.getElementById('xIsCount');
        var xIsNoticeCheckbox = document.getElementById('xIsNotice');
        var xIsCountTapd = document.getElementById('xIsCountTapd');
    
        // 将复选框的值转换为布尔值
        xIsCountCheckbox.value = xIsCountCheckbox.checked;
        xIsNoticeCheckbox.value = xIsNoticeCheckbox.checked;
        xIsCountTapd.value = xIsCountTapd.checked;
        
    });
    </script>
</body>
</html>